"use strict";
cc._RF.push(module, 'b78d8AlVpZEI6d2i+0H2rnZ', 'shop_role_item_node');
// scripts/shop_role_item_node.js

"use strict";

var e = require;
var t = module;
var o = exports;

var _ii,
    nn = void 0 && (void 0).__extends || (_ii = function ii(t, e) {
  return (_ii = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _ii(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    rr = void 0 && (void 0).__awaiter || function (t, e, o, i) {
  return new (o || (o = Promise))(function (n, a) {
    function r(t) {
      try {
        l(i.next(t));
      } catch (e) {
        a(e);
      }
    }

    function s(t) {
      try {
        l(i["throw"](t));
      } catch (e) {
        a(e);
      }
    }

    function l(t) {
      var e;
      t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
        t(e);
      })).then(r, s);
    }

    l((i = i.apply(t, e || [])).next());
  });
};

var oo = void 0 && (void 0).__decorate || function (e, t, a, n) {
  var i,
      o = arguments.length,
      s = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, a) : n;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);else for (var r = e.length - 1; r >= 0; r--) {
    (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
  }
  return o > 3 && s && Object.defineProperty(t, a, s), s;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var a = e("BaseModuleUI"),
    n = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("AssetsManager"),
    s = cc._decorator,
    l = s.ccclass,
    _ = s.property,
    c = function (e) {
  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    return t.choose_bg_node = null, t.hero_name_sprite = null, t.hero_head_sprite = null, t.have_hero_node = null, t.near_icon = null, t.far_icon = null, t.role_index = 0, t;
  }

  return nn(t, e), t.prototype.showRoleInfo = function (e, t) {
    this.role_index = t;
    var o = i.GlobalParams.playerSkinInfo.value;
    this.hero_name_sprite.spriteFrame = r["default"].getInstance().getHeroHeadFrame("hero_name_" + e.id), this.hero_head_sprite.spriteFrame = r["default"].getInstance().getHeroHeadFrame("hero_" + e.id), this.far_icon.active = 1 == e.C_type, this.near_icon.active = 0 == e.C_type, this.have_hero_node.active = -1 != o.have_hero.indexOf(t), this.choose_bg_node.active = o.use[0] == t, this.node.on("click", this.chooseThisRole, this);
  }, t.prototype.addEvent = function () {
    this.attachEvent(n["default"].SEND_CHOOSE_ROLE_INDEX_INFO, this.chooseRoleInfo, this);
  }, t.prototype.chooseRoleInfo = function (e, t) {
    this.choose_bg_node.active = t == this.role_index;
  }, t.prototype.chooseThisRole = function () {
    this.emitEvent(n["default"].SEND_CHOOSE_ROLE_INDEX_INFO, this.role_index);
  }, t.prototype.showItemType = function (e) {
    this.node.active = "all" == e || "near" == e && this.near_icon.active || "far" == e && this.far_icon.active;
  }, oo([_(cc.Node)], t.prototype, "choose_bg_node", void 0), oo([_(cc.Sprite)], t.prototype, "hero_name_sprite", void 0), oo([_(cc.Sprite)], t.prototype, "hero_head_sprite", void 0), oo([_(cc.Node)], t.prototype, "have_hero_node", void 0), oo([_(cc.Node)], t.prototype, "near_icon", void 0), oo([_(cc.Node)], t.prototype, "far_icon", void 0), oo([l], t);
}(a["default"]);

o["default"] = c;

cc._RF.pop();